﻿#include "FITKCCXModelInforManager.h"
namespace IO
{
    FITKCCXModelInforManager::FITKCCXModelInforManager()
    {
    }

    FITKCCXModelInforManager::~FITKCCXModelInforManager()
    {
    }

    void FITKCCXModelInforManager::addNodeMapping(const QPair<int, int> &abaqusNodeMappingKey, const int &calculixNodeMappingValue)
    {
        // 添加节点映射
        _ccxNodeMapping.insert(abaqusNodeMappingKey, calculixNodeMappingValue);
    }

    int FITKCCXModelInforManager::getNodeMappingValue(const QPair<int, int> &abaqusParentIDNodeID)
    {
        // CalculiX节点映射值
        int calculixNodeIndexValue = -1;
        if (_ccxNodeMapping.contains(abaqusParentIDNodeID))
        {
            calculixNodeIndexValue = _ccxNodeMapping.value(abaqusParentIDNodeID);
        }
        return calculixNodeIndexValue;
    }

    void FITKCCXModelInforManager::addElementMapping(const QPair<int, int> &abaqusElementMappingKey, const int &calculixElementMappingValue)
    {
        // 添加单元映射
        _ccxElementMapping.insert(abaqusElementMappingKey, calculixElementMappingValue);
    }

    int FITKCCXModelInforManager::getElementMappingValue(const QPair<int, int> &abaqusElementMappingKey)
    {
        // CalculiX单元映射值
        int calculixElementMappingValue = -1;
        if (_ccxElementMapping.contains(abaqusElementMappingKey))
        {
            calculixElementMappingValue = _ccxElementMapping.value(abaqusElementMappingKey);
        }
        return calculixElementMappingValue;
    }

    void FITKCCXModelInforManager::addSetMapping(const QPair<int, int> &abaqusSetMappingKey, const QString &calculixSetMappingValue)
    {
        // 添加集合映射
        _ccxSetMapping.insert(abaqusSetMappingKey, calculixSetMappingValue);
    }

    QString FITKCCXModelInforManager::getSetMappingValue(const QPair<int, int> &abaqusSetMappingKey)
    {
        // CalculiX集合映射值
        QString calculixSetMappingValue = "NOT_FOUND";
        if (_ccxSetMapping.contains(abaqusSetMappingKey))
        {
            calculixSetMappingValue = _ccxSetMapping.value(abaqusSetMappingKey);
        }
        return calculixSetMappingValue;
    }

    void FITKCCXModelInforManager::addSurfaceMapping(const QPair<int, int> &abaqusSurfaceMappingKey, const QString &calculixSurfaceMappingValue)
    {
        // 添加表面映射
        _ccxSurfaceMapping.insert(abaqusSurfaceMappingKey, calculixSurfaceMappingValue);
    }

    QString FITKCCXModelInforManager::getSurfaceMappingValue(const QPair<int, int> &abaqusSurfaceMappingKey)
    {
        // CalculiX表面映射值
        QString calculixSurfaceMappingValue = "NOT_FOUND";
        if (_ccxSurfaceMapping.contains(abaqusSurfaceMappingKey))
        {
            calculixSurfaceMappingValue = _ccxSurfaceMapping.value(abaqusSurfaceMappingKey);
        }
        return calculixSurfaceMappingValue;
    }
}